import Vue from 'vue'
import VueRouter from 'vue-router'
import Home from '../views/Home.vue'

Vue.use(VueRouter)

const routes = [
  {
    path: '/',
    name: 'Home',
    component: Home,
    redirect: "/recommend"
  },
  {
    path: '/recommend',
    name: 'Recommend',
    component: () => import('@/views/Recommend'),
    children: [

    ]
  },
  {
    path: '/hot',
    name: 'Hot',
    component: () => import('@/views/Hot')
  },
  {
    path: '/search',
    name: 'Search',
    component: () => import('@/views/Search')
  },
  {
    path: '/rank',
    name: 'Rank',
    props: true,
    component: () => import('@/views/Rank'),
    // children:[
    //   {
    //     name:'RankList',
    //     path: '/RankList',
    //       component: () => import('@/views/RankList')
    //   }
    // ]
  },
  {
    path: '/rankList/:id',
    name: 'RankList',
    props: true,
    meta:{
      // hideHead:true
    },
    component: () => import('@/views/RankList')
  },
  {
    path: '/recommendlist/:id',
    name: 'RecommendList',
    props: true,
    meta:{
      hideHead:true
    },
    component: () => import('@/views/RecommendList')
  },
 

]

const router = new VueRouter({
  mode: "hash",
  base: process.env.BASE_URL,
  routes
})
// router.beforeEach((to, from, next) => {
//   if (to.name == "RecommendList") {
//     // console.log(vm.$data)
//     next((vm) => {
//     console.log(1)

//       console.log(vm)
//       // vm.$data.showNav = false
//     });
//   } else {
//     next()
//   }

// })
export default router
